﻿using System.Configuration;

namespace M2B.GestionEntretiens
{
    public class ConfigWCFServicesHelper : ConfigurationSection
    {
        [ConfigurationProperty("Services")]
        public WCFServicesKeyCollection HashKeys
        {
            get { return ((WCFServicesKeyCollection)(base["Services"])); }
        }
    }
    [ConfigurationCollection(typeof(WCFServicesElement))]
    public class WCFServicesKeyCollection : ConfigurationElementCollection
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new WCFServicesElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((WCFServicesElement)(element)).Key;
        }

        public WCFServicesElement this[int idx]
        {
            get
            {
                return (WCFServicesElement)BaseGet(idx);
            }
        }

        public new WCFServicesElement this[string key]
        {
            get { return base.BaseGet(key) as WCFServicesElement; }
        }
    }
    public class WCFServicesElement : ConfigurationElement
    {
        [ConfigurationProperty("key", DefaultValue = "",
         IsKey = true, IsRequired = true)]
        public string Key
        {
            get
            {
                return ((string)(base["key"]));
            }
            set
            {
                base["key"] = value;
            }
        }

        [ConfigurationProperty("value",
          DefaultValue = "", IsKey = false, IsRequired = false)]
        public string Value
        {
            get
            {
                return ((string)(base["value"]));
            }
            set
            {
                base["value"] = value;
            }
        }
    }
}